package com.umeox.watch.moto.apiclient.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.HashMap;

public class TaskRecordDTO implements Parcelable {

    //记录ID
    public int id;

    //类型 0：系统内置；1：用户添加；2：目标赞念；
    public int type;

    //任务标识 type=0时使用
    public String action;

    //任务名称 type=1时使用
    //type = 2时   此为经文
    public String title;

    //任务内容 type=1时使用
    //type = 2时   此为注解
    public String content;

    //任务状态 0：进行中；1：待确认；2：已完成
    public int status;

    //创建时间
    public int createTime;

    //修改时间
    public int updateTime;

    //
    public String repeatExpression;

    //提醒时间 格式：HH:mm
    public String reminderTime;

    //额外信息
    public TaskRecordAdditionalInfoDTO additionalInfo;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeInt(this.type);
        dest.writeString(this.action);
        dest.writeString(this.title);
        dest.writeString(this.content);
        dest.writeInt(this.status);
        dest.writeInt(this.createTime);
        dest.writeInt(this.updateTime);
        dest.writeString(this.repeatExpression);
        dest.writeString(this.reminderTime);
        dest.writeParcelable(additionalInfo, flags);
    }

    public TaskRecordDTO() {

    }

    protected TaskRecordDTO(Parcel in) {
        this.id = in.readInt();
        this.type = in.readInt();
        this.action = in.readString();
        this.title = in.readString();
        this.content = in.readString();
        this.status = in.readInt();
        this.createTime = in.readInt();
        this.updateTime = in.readInt();
        this.repeatExpression = in.readString();
        this.reminderTime = in.readString();
        this.additionalInfo = in.readParcelable(TaskRecordAdditionalInfoDTO.class.getClassLoader());
    }

    public static final Parcelable.Creator<TaskRecordDTO> CREATOR = new Parcelable.Creator<TaskRecordDTO>() {
        public TaskRecordDTO createFromParcel(Parcel source) {
            return new TaskRecordDTO(source);
        }

        public TaskRecordDTO[] newArray(int size) {
            return new TaskRecordDTO[size];
        }
    };

    @Override
    public String toString() {
        return "TaskRecordDTO{" +
                "id=" + id +
                ", type=" + type +
                ", action='" + action + '\'' +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", status=" + status +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", repeatExpression='" + repeatExpression + '\'' +
                ", reminderTime='" + reminderTime + '\'' +
                ", additionalInfo=" + additionalInfo +
                '}';
    }
}
